<script setup lang="ts">
import { ElSwitch } from "element-plus";
import { ref } from "vue";
import { useAppStore } from "@/store/modules/app";
const appStore = useAppStore();

// 初始化获取是否是暗黑主题
const isDark = ref(appStore.getIsDark);

const chageTheme = (val: any) => {
  appStore.setIsDark(val);
};
</script>

<template>
  <el-switch
    v-model="isDark"
    @change="chageTheme"
    active-action-icon="Moon"
    inactive-action-icon="Sunny"
  />
</template>
<style scoped lang="less"></style>
